const TerserPlugin = require('terser-webpack-plugin');

module.exports = (ctx) => {
  ctx.modifyWebpackChain(args => {
    const chain = args.chain;

    chain.merge({
      optimization: {
        minimize: true,
        minimizer: [
          new TerserPlugin({
            test: ['taro.js','vendors.js','app.js'],
            parallel: true,
            cache: true,
            extractComments: true,
            parallel: true,
            sourceMap: true,
            terserOptions:{},
          })
        ]
      }
    })
  })
}
